package com.it.reggie.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.it.reggie.entity.Dish;
import com.it.reggie.mapper.DishMapper;
import com.it.reggie.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class DishServiceImpl extends ServiceImpl<DishMapper, Dish> implements DishService {

    @Autowired
    private DishMapper dishMapper;

    @Override
    public void upDateStatus(Integer status,List<Long> ids) {

        LambdaQueryWrapper<Dish> qw = new LambdaQueryWrapper<>();

        qw.in(Dish::getId, ids);

        Dish dish = new Dish();

        dish.setStatus(status);

        dishMapper.update(dish,qw);


    }

}
